//店铺设置弹窗
import { message, Form, Drawer } from "antd";
import { useEffect, useRef, useState } from "react";
import SearchContent from "./component/SearchContent";
import CommonDrawer from '@/components/CommonDrawer';
import TableList from "./component/TableList";

const GenerateCombination = ({ visible, handleCancel, handleOk }) => {
	const [query, setQuery] = useState({});

	const [form] = Form.useForm();

	const divEl = useRef(null);

	const searchProps = {
		query,
		handleSearch(val) {
			if (val && Object.keys(val)?.length) {
				setQuery(val);
			} else {
				setQuery({});
			}
		}
	};

	const tableProps = {
		query,
		divEl
	};

	return (
		<CommonDrawer
			title="待生成组合装"
			open={visible}
			onClose={handleCancel}
			onOk={() => {
				form.submit();
			}}
			footer={null}
			width="80%"
			// okText="保存"
		>
			<>
				<div ref={divEl}>
					<SearchContent {...searchProps} />
				</div>
				<TableList {...tableProps} />
			</>
		</CommonDrawer>
	);
};

export default GenerateCombination;
